﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using CommonFoundation.DataModel;
using CommonFoundation.DataSource;

namespace WHULive
{
    /// <summary>
    /// SetWindow.xaml 的交互逻辑
    /// </summary>
    public partial class SetWindow : Window
    {
        public SetWindow()
        {
            InitializeComponent();

            this.UpdateTextBox();
        }

        private void UpdateTextBox()
        {
            ConfigureAdmin.GetConfigure();

            this.GoogleIDTextBox.Text = BindingSource.GetInstance().GoogleID;
            this.StudentIDTextBox.Text = BindingSource.GetInstance().StudentID;

            this.SaveFilePathTextBox.Text = FilePath.GetInstance().SaveFilePath;
        }

        private void SaveConfigureButton_Click(object sender, RoutedEventArgs e)
        {
            BindingSource.GetInstance().GoogleID = this.GoogleIDTextBox.Text;

            BindingSource.GetInstance().StudentID = this.StudentIDTextBox.Text;

            FilePath.GetInstance().SaveFilePath = this.SaveFilePathTextBox.Text;

            ConfigureAdmin.SaveConfigure();

            this.Close();
        }

    }
}
